<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="layout" content="bolao" />
    <g:set var="entityName" value="${message(code: 'cup.label', default: 'Cup')}" />
    <title><g:message code="default.edit.label" args="[entityName]" /></title>
</head>
<body>
  <div class="body">
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${cup}">
      <div class="errors">
        <g:renderErrors bean="${cup}" as="list" />
      </div>
    </g:hasErrors>
    <g:form method="post" >
      <g:hiddenField name="id" value="${cup?.id}" />
      <g:hiddenField name="version" value="${cup?.version}" />
      <div class="dialog">
      <fieldset>
        <legend><g:message code="default.edit.label" args="[entityName]" /></legend>
        <table>
          <tbody>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="year"><g:message code="cup.year.label" default="Year" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: cup, field: 'year', 'errors')}">
                ${cup.year.encodeAsHTML()}
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="venue"><g:message code="cup.venue.label" default="Venue" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: cup, field: 'venue', 'errors')}">
                <g:textField name="venue" maxlength="50" value="${cup?.venue}" />
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="groups"><g:message code="cup.groups.label" default="Groups" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: cup, field: 'groups', 'errors')}">
                <g:each in="${cup?.groups?}" var="g">
                  <g:link controller="group" action="show" id="${g.id}">${g?.name?.encodeAsHTML()}</g:link>
                </g:each>
                <g:link controller="group" action="create" params="['cup.id': cup?.id]">${message(code: 'default.add.label', args: [message(code: 'group.label', default: 'Group')])}</g:link>
              </td>
            </tr>
          </tbody>
        </table>
      </fieldset>
      </div>
      <div class="buttons">
        <g:ifAnyGranted role="ROLE_ADMIN">
        <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
        <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
        </g:ifAnyGranted>
      </div>
    </g:form>
  </div>
</body>
</html>
